package dk.dtu.compute.course02312.matadorfinal;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidMain.Game;

public class MainActivity extends Activity {

	public static MainActivity context;
	private Game game;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		System.out.println("Entered onCreate");
		super.onCreate(savedInstanceState);
//		setContentView(R.layout.activity_main);
		MainActivity.context = this;
		
		this.game = new Game();
		this.game.start();
		
		System.out.println("Exited onCreate");
	}

	@Override public boolean onCreateOptionsMenu(Menu menu) {
		System.out.println("Entered onCreateOptionsMenu");
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	@Override protected void onStart() {
		System.out.println("Entered onStart");
		super.onStart();
	}
	@Override	protected void onRestart() {
		System.out.println("Entered onRestart");
		super.onRestart();
	}
	@Override protected void onResume() {
		System.out.println("Entered onResume");
		super.onResume();
	}
	@Override	protected void onPause() {
		System.out.println("Entered onPause");
		super.onPause();
	}
	@Override	protected void onStop() {
		System.out.println("Entered onStop");
		super.onStop();
	}
	@Override protected void onDestroy() {
		System.out.println("Entered onDestroy");
		super.onDestroy();
	}
	@Override public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle item selection
	    switch (item.getItemId()) {
//	        case R.id.new_game:
//	        	this.game = new Game();
//	        	this.game.run(); //TODO hmm....
//	            return true;
	        case R.id.quit_game:
	        	this.game.end();
	            return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}
}
   